package com.bdqn.crm.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bdqn.crm.mapper.RightMapper;
import com.bdqn.crm.pojo.Right;
import com.bdqn.crm.pojo.Role;
import com.bdqn.crm.mapper.RoleMapper;

import com.bdqn.crm.pojo.User;
import com.bdqn.crm.service.RoleService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;

@Service(value = "roleService")
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {
    @Resource
    private RightMapper rightMapper;

    @Resource
    private  RoleMapper roleMapper;

    @Override
    public List<Role> findAllRoles() {
        return roleMapper.findAllRoles();
    }

    @Override
    public List<Right> finAllRights() {
        return roleMapper.finAllRights();
    }

    @Override
    public List<Right> findRightsByRole(Role role) {
        return roleMapper.findRightsByRole(role);
    }

    @Override
    public Role saveRole(Role role) {
        return roleMapper.saveRole(role);
    }

    @Override
    public void deleteRoleById(Long roleId) {
        roleMapper.deleteRoleById(roleId);
    }

    @Override
    public void deleteRole(Role role) {
        roleMapper.deleteRole(role);
    }

    @Override
    public Role getRole(Long roleId) {
        return roleMapper.getRole(roleId);
    }

    @Override
    public Page<Role> findRole(String roleName, org.springframework.data.domain.Pageable pageable) {
        return roleMapper.findRole(roleName,pageable);
    }

    @Override
    public Role findRoleByUser(User user) {
        return roleMapper.findRoleByUser(user);
    }

    @Override
    public void reloadFilterChainDefinitions() {

    }

    @Override
    public Map<String, String> loadFilterChainDefinitions() {
        return Map.of();
    }


}




